package com.bnz.service.impl;

import com.bnz.entity.Dept;
import com.bnz.mapper.DeptMapper;
import com.bnz.service.DeptService;
import com.bnz.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class DeptServiceImpl implements DeptService {
    // 查询所有部门信息
    @Override
    public List<Dept> findAll() {
        try(SqlSession sqlSession = MybatisUtil.getSqlSession(true)) {
            DeptMapper mapper = sqlSession.getMapper(DeptMapper.class);
            return mapper.findAll();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
